package zhang.lao.api.controller;/**
 * Created by zhangqin on 2017/10/23.
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import zhang.lao.api.service.FarmService;
import zhang.lao.extents.spring.handle.ApiData;
import zhang.lao.pojo.ApiGt06PointReq;
import zhang.lao.pojo.api.req.*;
import zhang.lao.pojo.api.resp.ApiRespData;

/**
 * @author
 * @create 2017-10-23 15:37
 **/

@Controller
public class FarmController {

    @Autowired
    private FarmService farmService;

    @RequestMapping("/api/fram/list")
        public @ResponseBody ApiRespData getFarms(@ApiData ApiReqData<ApiReqBody> apiReqBodyApiReqData){
            return farmService.getFarms(apiReqBodyApiReqData);
        }
    @RequestMapping("/api/device/info/list")
    public @ResponseBody ApiRespData getDevices(@ApiData ApiReqData<ApiDeviceListReq> apiReqBodyApiReqData){
        return farmService.getDevices(apiReqBodyApiReqData);
    }

    @RequestMapping("/api/user/overview")
    public @ResponseBody ApiRespData userOverview(@ApiData ApiReqData<ApiReqBody> apiReqBodyApiReqData){
        return farmService.userOverview(apiReqBodyApiReqData);
    }

    @RequestMapping("/api/device/location/back")
    public @ResponseBody ApiRespData getDevicesLocation(@ApiData ApiReqData<ApiGt06PointReq> apiReqBodyApiReqData){
        return farmService.gt06PointReq(apiReqBodyApiReqData);
    }




    @RequestMapping("/api/farmland/list")
    public @ResponseBody ApiRespData farmlandList(@ApiData ApiReqData<ApiWnFarmlandListReq> apiReqBodyApiReqData){
        return farmService.apiWnFarmlandListResp(apiReqBodyApiReqData);
    }


    @RequestMapping("/api/farmland/add")
    public @ResponseBody ApiRespData farmlandAdd(@ApiData ApiReqData<ApiWnFarmlandAddReq> apiReqBodyApiReqData){
        return farmService.apiWnFarmlandAddResp(apiReqBodyApiReqData);
    }


    @RequestMapping("/api/device/work/dates")
    public @ResponseBody ApiRespData apiDeviceActiceDatesResp(@ApiData ApiReqData<ApiDeviceActiceDatesReq> apiReqBodyApiReqData){
        return farmService.apiDeviceActiceDatesResp(apiReqBodyApiReqData);
    }



}
